﻿namespace MicroCloud.Systems
{
    public interface IFileStore<TFile> where TFile : class
    {
        IQueryable<TFile> Files { get; }

        TFile FindById(string fileId);
        Task<TFile> FindByIdAsync(string fileId, CancellationToken cancellationToken = new CancellationToken());

        bool CheckFileExists(Expression<Func<TFile, bool>> predicate, string fileId = default);
        Task<bool> CheckFileExistsAsync(Expression<Func<TFile, bool>> predicate, string fileId = default, CancellationToken cancellationToken = new CancellationToken());

        OperationResult Create(TFile fileEntity);
        Task<OperationResult> CreateAsync(TFile fileEntity, CancellationToken cancellationToken = new CancellationToken());

        OperationResult Update(TFile fileEntity);
        Task<OperationResult> UpdateAsync(TFile fileEntity, CancellationToken cancellationToken = new CancellationToken());

        OperationResult Delete(TFile fileEntity);
        Task<OperationResult> DeleteAsync(TFile fileEntity, CancellationToken cancellationToken = new CancellationToken());
    }
}